#include <stdio.h>
int Gcd(int a, int b);
int IsPrime(int n);


int main()
{  	  	  	 
    int m, n, f;
    printf("Input m and n:");
    scanf("%d,%d", &m, &n);
    f = Gcd(m, n);//1
    if (f != -1)//1
    {  	  	  	 
        printf("The GCD of %d and %d is %d \n", m , n, f);
        if (IsPrime(f))
        {  	  	  	 
            printf("%d is prime number\n", f );
        }
        else
        {  	  	  	 
            printf("%d is not prime number\n", f );
        }

    }
    else
    {  	  	  	 
        printf("Input error!\n");
    }
    return 0;
}  	  	  	 
// 函数功能：计算a和b的最大公约数，输入负数时返回-1
int Gcd(int a, int b) //1
{  	  	  	 
    int i, t;
    if (a <= 0 || b <= 0) //1
    {  	  	  	 
        return -1; //1
    }
    t = a < b ? a : b;  //1
    for (i = t; i > 0; i--)//1
    {  	  	  	 
        if (a % i == 0 && b % i == 0)//1
            return i;  //1
    }
    return 1; //1
}  	  	  	 
int IsPrime(int n)
{  	  	  	 
    int isPrime = 1, i;
    if (n <= 1) return 0;//1
    for (i = 2; i < n; i++)//1
    {  	  	  	 
        if (n % i == 0)//1
        {  	  	  	 
            isPrime = 0;
            break;
        }
    }
    return isPrime;
}